package cn.stylefeng.guns.modular.demo.controller.convert;

import cn.stylefeng.guns.dao.entity.Rule;
import cn.stylefeng.guns.dao.entity.RuleSupplier;
import cn.stylefeng.guns.modular.demo.controller.domain.RuleSupplierVO;
import cn.stylefeng.guns.modular.demo.controller.domain.RuleVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

@Mapper(componentModel = "spring")
public interface RuleConverter {

    @Mapping(target = "createTime", expression = "java(rule.getCreateTime().toInstant().toEpochMilli())")
    RuleVO convert(Rule rule);

    @Mapping(target = "createTime", expression = "java(ruleSupplier.getCreateTime().toInstant().toEpochMilli())")
    RuleSupplierVO do2vo(RuleSupplier ruleSupplier);
}
